home *** CD-ROM | disk | FTP | other *** search
/ HTBasic 9.3 / HTBasic 9.3.iso / SICL / data1.cab / sicl32 / c / samples / misc / landev.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-03-02  |  1.2 KB  |  56 lines

  1. /* landev.c 
  2.    This example program sends a scan list to a switch and while
  3.    looping closes channels and takes measurements. */
  4. #include <sicl.h>
  5. #include <stdio.h>
  6.  
  7. main()
  8. {
  9.   INST dvm;
  10.   INST sw;
  11.  
  12.   double res;
  13.   int i;
  14.  
  15.   /* Print message and terminate on error */
  16.   ionerror (I_ERROR_EXIT);
  17.  
  18.   /* Open the multimeter and switch sessions */
  19.   dvm = iopen ("lan[instserv]:hpib,9,3");
  20.   sw = iopen ("lan[instserv]:hpib,9,14");
  21.   itimeout (dvm, 10000);
  22.   itimeout (sw, 10000);
  23.  
  24.   /*Set up trigger*/
  25.   iprintf (sw, "TRIG:SOUR BUS\n");
  26.  
  27.   /*Set up scan list*/
  28.   iprintf (sw,"SCAN (@100:103)\n");
  29.   iprintf (sw,"INIT\n");
  30.  
  31.   for (i=1;i<=4;i++)
  32.   {
  33.     /* Take a measurement */
  34.     iprintf (dvm,"MEAS:VOLT:DC?\n");
  35.  
  36.     /* Read the results */
  37.     iscanf (dvm,"%lf", &res);
  38.  
  39.     /* Print the results */
  40.     printf ("Result is %f\n",res);
  41.   
  42.     /*Trigger to close channel*/
  43.     iprintf (sw, "TRIG\n");
  44.   }
  45.   /* Close the multimeter and switch sessions */
  46.   iclose (dvm);
  47.   iclose (sw);
  48.  
  49. /* For WIN16 programs, call _siclcleanup before exiting to release
  50.    resources allocated by SICL for this application.  This call
  51.    is a no-op for WIN32 programs. */
  52.   _siclcleanup();
  53.  
  54.   return 0;
  55. }
  56.